<?php
/**
 * 
 */
class Testorder extends Base
{
/*发起APP阿里支付订单*/
/*
function SubmitAlipaysend($OrderId,$body="jz",$subject="ms",$UserId="123",$PayMoney=5,$PayType="",$NotifyPage = "https://www.xxxxxks.top/MAS/msAlipay/ok.php"){


            $aop = new AopClient();
            $aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
            $aop->appId = '2019061865592321'; //支付宝分配给开发者的应用ID

            $aop->alipayrsaPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkmWioKS9ldcOuxZuDnBNjuxFWTOlFHBtEjlJ3mEBelku7XWM/7vlDA7O7diN7hyQ7Yjm8ldbC4mATHuG7BoW8kmxDk3Z7S0HbvbcO4BjcqYX42Jwk5XKbMqajQqMEr568PLHO2foQJaSAkdsAPLvFoylZj2ZH0NwHVwrJvkKoIOO19u01cXq8JbmpIgcaOF3tJ+8qMhww9ymteAz/rmzDHPN7DZCgMriXuWcLQE8m+e323ECUgCLD6hDATVPqIUQdvVumWAikBUTeOYS9fLtvF20ZYcmtSonW3hfrjf6FzciFpJgbbY66RbmN0AKv6Cvb2n7XAemi6yR/D1FDlgonwIDAQAB'; //支付宝公钥

            $aop->rsaPrivateKey='MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDWTjjQYZXk2s36li3LwrrjoT3zR/pCsplv7hdhwkfCeT9v+8mxA1lz3DLzZDnIZTs31+fZA9Cd/b+XoOE7f/M8JA3dwuUSHfj2Qn4a/5/T4wMWgwS2YWWyOPHzWJ6c4y9PF3yGPRhqfpENLBOkhWuh0DIiDEeMcK3WPJhJFg353uimVJBKshX/trXi5PItAzpAvTZyaGLewD8IHdRUVyzC+2G99BDxIRblQ1XjCP9Bx1So/3cX4rVuw0nncoLm39awOgm9dtlAL9FX919AN5JO8pN+kLJ4SvmHguEqD41CQYHszXOlXdT02N+qdyODbeEsnd2GCO4yyZn803KzsXC1AgMBAAECggEAU5gXmVE3gxnGl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GOz+b4cCXEM3sXA0ci6YL7MROIw7EDVV78HUK7WQcP9XNUcRVvFMlHG/3c0ajuBKOgVkkTTgMUEm7y+sdR2B4KWNxQPSfH2Q6hSx1l4cExFam/uRAfUOQvWHZ657jbU9whZV13hBMG'; // 请填写开发者私钥去头去尾去回车，一行字符串*/
//支付宝
public function test(){
		import('.Alipay.aop.AopClient','', '.php');
        import('.Alipay.aop.request.AlipayTradeAppPayRequest', '', '.php');
        $notify_url='http://http://www.qyzf.xyz/api/Payment/alipay_notify';
        $config = array(
            'appid' =>'2019061865592321',//
            'rsaPrivateKey' =>'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDWTjjQYZXk2s36li3LwrrjoT3zR/pCsplv7hdhwkfCeT9v+8mxA1lz3DLzZDnIZTs31+fZA9Cd/b+XoOE7f/M8JA3dwuUSHfj2Qn4a/5/T4wMWgwS2YWWyOPHzWJ6c4y9PF3yGPRhqfpENLBOkhWuh0DIiDEeMcK3WPJhJFg353uimVJBKshX/trXi5PItAzpAvTZyaGLewD8IHdRUVyzC+2G99BDxIRblQ1XjCP9Bx1So/3cX4rVuw0nncoLm39awOgm9dtlAL9FX919AN5JO8pN+kLJ4SvmHguEqD41CQYHszXOlXdT02N+qdyODbeEsnd2GCO4yyZn803KzsXC1AgMBAAECggEAU5gXmVE3gxnGlyTVoFHJTNmsrKU6/aFlMMAS5tM94qIhGLGCr0W7MvKF/WLvFzhFrTbO/Vv7mGVOwvrCYM88Ng1qS0Km0DZY0taFEkr8MU6v+awJvoqnfKmx11aOKGyGG7fxnvtd9syAED9NOjPBFFF9/MIFdsbNSHBCht/Pe9O81V3QMpQ8AzNVbEwP0p1Ga1tY5x/23UFUI1mFrshFAuMEAJSfAOqhVHcjJqzaN3fvkYmlJJ54o1VYhxUi6ai590Ll0vNnEMpdnkPBFyZFxWp9Ey5QXkQj9Od5m19lspsU6o2Y3Cb9+pwfW7Cm4pSCH5NaoXBJXyXRqGqOJsTqgQKB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qMEr568PLHO2foQJaSAkdsAPLvFoylZj2ZH0NwHVwrJvkKoIOO19u01cXq8JbmpIgcaOF3tJ+8qMhww9ymteAz/rmzDHPN7DZCgMriXuWcLQE8m+e323ECUgCLD6hDATVPqIUQdvVumWAikBUTeOYS9fLtvF20ZYcmtSonW3hfrjf6FzciFpJgbbY66RbmN0AKv6Cvb2n7XAemi6yR/D1FDlgonwIDAQAB',//支付宝公钥
            'charset'=>strtolower('utf-8'),//编码
            'notify_url' =>$notify_url,//回调地址(支付宝支付成功后回调修改订单状态的地址)
            'payment_type' =>1,//(固定值)
            'seller_id' =>'',//收款商家账号
            'charset'    => 'utf-8',//编码
            'sign_type' => 'RSA2',//签名方式
            'timestamp' =>date("Y-m-d H:i:s"),
            'version'   =>"1.0",//固定值
            'url'       => 'https://openapi.alipay.com/gateway.do',//固定值
            'method'    => 'alipay.trade.app.pay',//固定值
        );
         
                    $aop = new \AopClient();
                    $aop->gatewayUrl = "https://openapi.alipay.com/gateway.do";
                    $aop->appId = $config['appid'];
                    $aop->rsaPrivateKey = $config['rsaPrivateKey'];
                    $aop->format = "json";
                    $aop->charset = "UTF-8";
                    $aop->signType = "RSA2";
                    $aop->alipayrsaPublicKey=$config['alipayrsaPublicKey'];
          			  //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称：alipay.trade.app.pay
                    $request = new \AlipayTradeAppPayRequest();
           			 //SDK已经封装掉了公共参数，这里只需要传入业务参数
                   
                    $bizcontent = json_encode([
                            'body'=>'APP',
                            'subject'=>'appaa',
                            'out_trade_no'=> 'sdasd004564csac',//此订单号为商户唯一订单号
                            'total_amount'=>5.01,//保留两位小数
                            'product_code'=>'QUICK_MSECURITY_PAY'
                    ]);
                    $request->setNotifyUrl($config['notify_url']);
                    $request->setBizContent($bizcontent);
            		//这里和普通的接口调用不同，使用的是sdkExecute
                    $response = $aop->sdkExecute($request);
                //htmlspecialchars是为了输出到页面时防止被浏览器将关键参数html转义，实际打印到日志以及http传输不会有这个问题
                $datas=$response;//就是orderString 可以直接给客户端请求，无需再做处理。
                $this->arr['code']=0;
                $this->arr['msg']=$order_sn;
                $this->arr['info']=$datas;
                echo json_encode($this->arr);exit;
}

?>